package com.lzj.demo.collection.string;

import java.util.Scanner;

public class StringTest01 {
    public static void main(String[] args) {

        for (int i = 0; i < 3; i++) {
            String username = "linzejian";
            String password = "abc";
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入账号");
            String name = sc.nextLine();
            System.out.println("请输入密码");
            String pwd = sc.nextLine();
            if (name.equals(username) && pwd.equals(password)) {
                System.out.println("登录成功");
                break;
            } else {
                if (2 - i == 0) {
                    System.out.println("你的账号已被冻结请联系管理员");
                } else {
                    System.out.println("登入失败还有" + (2 - i) + "机会");
                }
            }
        }
    }
}